home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
pshdir1a.zip
/
POPDIR.LST
< prev
next >
Wrap
File List
|
1988-12-22
|
9KB
|
158 lines
Turbo Assembler Version 1.0 12-22-88 23:23:29 Page 1
POPDIR.ASM
1 main group code
2 0000 code segment public para 'code'
3 assume cs:main
4
5 org 100h ;.COM file
6
7 0100 E9 020E BEGIN: jmp START ;program starts here
8 ; db "Copyright 1986 Ziff-Davis Publishing Co.",1Ah
9 ; Changes made on 12/22/88 by Mike Williams
10 ; 1. Support command line parm to also CHDIR
11 ; 2. If path string refers to a drive, log that drive
12 ;
13 0103 50 55 53 48 44 49 52 + signature db 'PUSHDIR VERSION 1.a'
14 20 56 45 52 53 49 4F +
15 4E 20 31 2E 61
16 = 0013 lengthsignature = $ - signature
17
18 0116 ???????? savedint16 dd ? ;used to be identical to pushdir
19
20 011A 011Cr nextpush dw offset main:push1dir ;next place to save a dir
21 011C 43*(00) push1dir db 67 dup (0)
22 015F 43*(00) push2dir db 67 dup (0)
23 01A2 43*(00) push3dir db 67 dup (0)
24 01E5 43*(00) push4dir db 67 dup (0)
25 0228 43*(00) push5dir db 67 dup (0)
26 026B 43*(00) push6dir db 67 dup (0)
27
28 ;up to here must be EXACTLY identical in both PUSHDIR and POPDIR.
29
30 02AE 4D 75 73 74 20 72 75 + notinstalled1 db 'Must run PUSHDIR.COM before POPDIR.COM'
31 6E 20 50 55 53 48 44 +
32 49 52 2E 43 4F 4D 20 +
33 62 65 66 6F 72 65 20 +
34 50 4F 50 44 49 52 2E +
35 43 4F 4D
36 02D4 20 77 69 6C 6C 20 64 + db ' will do anything.',13,10,10,'$'
37 6F 20 61 6E 79 74 68 +
38 69 6E 67 2E 0D 0A 0A +
39 24
40 02EA 45 72 72 6F 72 20 70 + errpop1 db 'Error popping the current directory',13,10,10,'$'
41 6F 70 70 69 6E 67 20 +
42 74 68 65 20 63 75 72 +
43 72 65 6E 74 20 64 69 +
44 72 65 63 74 6F 72 79 +
45 0D 0A 0A 24
46
47 0311 START:
48 0311 FB sti ;interrupts on
49
50 ;is PUSHDIR already installed ?
51
52 0312 B8 7788 mov ax,7788h ;signature request
53 0315 BB 7789 mov bx,7789h ;signature request
54 0318 BE 0103r mov si,offset main:signature ;point ds:si to signature
55 031B CD 16 int 16h ;is it installed ?
56
57 assume ds:nothing
58
59 031D 81 FB 7788 cmp bx,7788h ;were ax and bx switched ?
Turbo Assembler Version 1.0 12-22-88 23:23:29 Page 2
POPDIR.ASM
60 0321 75 07 jne NOTINSTALLED ;no
61 0323 3D 7789 cmp ax,7789h ;were ax and bx switched ?
62 0326 75 02 jne NOTINSTALLED ;no
63 0328 EB 09 jmp short ISINSTALLED ;yes - continue, no error
64 032A NOTINSTALLED:
65
66 ;here PUSHDIR was not previously installed so POPDIR can't do anything
67 ;useful so we just terminate with an error message.
68
69 032A BA 02AEr mov dx,offset main:notinstalled1 ;error message
70 032D B4 09 mov ah,9
71 032F CD 21 int 21h
72 0331 CD 20 int 20h ;exit
73
74
75 0333 ISINSTALLED:
76
77 ;get the address of the directory previously saved by pushdir
78
79 0333 8B 2E 011Ar mov bp,ds:[nextpush] ;get the next push location
80 0337 83 ED 43 sub bp,67 ;back up one to the last push
81 033A 81 3E 011Ar 011Cr cmp ds:[nextpush],offset main:push1dir ;need to wrap back ?
82 0340 75 03 jne NOWRAPBACK ;no
83 0342 BD 026Br mov bp,offset main:push6dir ;yes, wrap back
84 0345 NOWRAPBACK:
85
86 ;set the current directory
87
88 0345 8B D5 mov dx,bp ;load ds:dx with directory to set
89 0347 B4 3B mov ah,3bh ;dos function number
90 0349 CD 21 int 21h ;set current dir back
91 034B 72 11 jc ERRPOP ;branch on error
92 034D 89 2E 011Ar mov ds:[nextpush],bp ;update [nextpush] if successful
93
94 ;set the current drive also
95
96 0351 3E: 8A 56 00 mov dl,ds:[bp] ;get drive letter from path
97 0355 80 EA 41 sub dl,'A' ;convert to binary (0=A, 1=B)
98 0358 B4 0E mov ah,0eh ;dos function number
99 035A CD 21 int 21h ;set drive
100
101 ;exit successfully with no message
102
103 035C CD 20 int 20h ;exit
104
105 035E ERRPOP:
106 035E 0E push cs
107 035F 1F pop ds ;set ds = cs
108 0360 BA 02EAr mov dx,offset main:errpop1 ;error message
109 0363 B4 09 mov ah,9 ;dos function number
110 0365 CD 21 int 21h ;show the message
111 0367 CD 20 int 20h ;terminate
112
113 0369 code ends
114 end BEGIN ;start execution at BEGIN
Turbo Assembler Version 1.0 12-22-88 23:23:29 Page 3
Symbol Table
Symbol Name Type Value
??DATE Text "12-22-88"
??FILENAME Text "POPDIR "
??TIME Text "23:23:29"
??VERSION Number 0100
@CPU Text 0101H
@CURSEG Text CODE
@FILENAME Text POPDIR
@WORDSIZE Text 2
BEGIN Near CODE:0100
ERRPOP Near CODE:035E
ERRPOP1